/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package probando;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * @author Administrador
 */
public class servidor {



     public void runServer() throws IOException
   {
      ServerSocket serv=null;//para comunicacion
      //ServerSocket serv2=null;//para enviar mensajes
      boolean listening=true;
      try{
         serv=new ServerSocket(1337);
         //serv2=new ServerSocket(8082);
         System.out.println(".::Servidor activo :");
         while(listening)
         {
            Socket sock=null,sock2=null;
            try {
                System.out.println("Esperando Usuarios");

                sock=serv.accept();

                //sock2=serv2.accept();
            } catch (IOException e)
            {
                System.out.println("Accept failed: " + serv + ", " + e.getMessage());
               continue;
            }
            hiloservidor user= new hiloservidor (sock);
            user.start();
         }

      }catch(IOException e){
          System.out.println("error en el servidor :"+e);
      }
   }

}
